<?php
include "../inc-config.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Move Thread</title>
<style type="text/css">
<!--
body {
background-color: #000000;
background-image: url(../images/alliance-tile.jpg); background-repeat:repeat-x;
}
body,td,th {
color: #CC9900;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
a:link {
color:#CC9900; 


}
a:visited {
color:#CC9900;

}
a:hover {
color:#ffffff;
}
a:active {
color:#FF0000;
}	


input { background:transparent; background-image:url(../images/transp.png); color:#FFFFFF; border: 1px solid #333333}
select { background-color:#000000; color:#FFFFFF; border: 1px solid #333333}
textarea { background-color:#000000; color:#FFFFFF; border: 1px solid #333333}

-->
</style>
</head>

<body>
<center>

<?php
echo "<br><br><br><br><table style='border: 1px solid #000000; background-image: url(../images/transp.png)'>";
echo "<tr class='headline'><td><center><strong>Lock Thread</strong></center></td></tr>";
echo "<tr class='forumrow'><td>";
$user = $_SESSION['user'];

$getuser = "SELECT * from b_users a, b_templates b where b.templateid=a.templateclass and a.username='$user'";
$getuser2 = mysql_query($getuser, $forum) or die("Could not get user info");
$getuser3 = mysql_fetch_array($getuser2);

$ID = $_GET['ID'];
$gettopic = "SELECT * from b_posts, b_users where b_posts.ID='$ID' and b_users.userID=b_posts.author";
$gettopic2 = mysql_query($gettopic, $forum) or die("Could not get topic");
$gettopic3 = mysql_fetch_array($gettopic2);

if(strlen($getuser3['username']) > 1)
{
	$templateclass=$getuser3['templatepath'];
}
else
{
	$templateclass="default";
}
if($getuser3['status']<1 || ($getuser3['status'] <= $gettopic3['status'] && $getuser3['userID'] != $gettopic3['userID']))
{
	die("<table style='border: 1px solid #000000; background-image: url(../images/transp.png)'><tr class='headline'><td><center>Lock Thread</center></td></tr><tr class='forumrow'><td><center>You do not have permission to lock this thread</center></td></tr></table>");
}
else
{
	if(isset($_POST['submit']))
	{
		$threadid=$_POST['threadid'];
		$lock="Update b_posts set locked='1' where ID='$threadid'";
		mysql_query($lock, $forum) or die("Could not lock thread");
		
		$lock3="Update b_posts set locked='1' where threadparent='$threadid'";
		mysql_query($lock3, $forum) or die("Could not lock posts");
		echo "Thread Locked<br><br><a href='index.php'>Go to forum Index</a>";
	}
	else
	{
		echo "<center><form action='lockthread.php?ID=$ID' method='post'>";
		echo "<br>Are You sure you want to lock this thread?<br>";
		echo "<input type='hidden' name='threadid' value='$ID'>";
		echo "<br><input type='submit' name='submit' value='Lock Thread'></form></center>";  
	}
}
?>
</center>
</body>
</html>